import service from '@/api/index.ts'

/**
 * 初始化
 * @param sign
 * @param token
 * @param timestamp
 * @constructor
 */
export const DepositInit = async (sign: string, token: string, timestamp: string) => {
	const res: any = await service.post(`/new_mobile/deposit/depositInit`, {
		sign,
		token,
		timestamp,
	})
	return res
}

/**
 * 获取数据
 * @param obj
 * @constructor
 */
export const GetProjectInfo = async (obj: ObjType) => {
	const { token, contractorCreditCode, contractorUnitName, operatorId, operatorName, itemName } = obj
	const res: any = await service.post(`/new_mobile/deposit/getProjectInfo`, {
		token,
		contractorCreditCode,
		contractorUnitName,
		operatorId,
		operatorName,
		itemName,
	})
	return res
}

/**
 * 提交
 * @param allInfoId
 * @constructor
 */
export const SubmitDeposit = async (allInfoId: string) => {
	const res: any = await service.post(`/new_mobile/deposit/submitDeposit`, {
		allInfoId,
	})
	return res
}

export interface ObjType {
	token: string
	contractorCreditCode: string
	contractorUnitName: string
	operatorId: string
	operatorName: string
	itemName: string
}
